import React, { Component } from "react";
import Login from "./compoments/Login";
import Register from "./compoments/Register";
import BottomBackGround from "./compoments/BottomBackGround";
import "./index.scss";
class LoginAndRegister extends Component {
  state = {
    // "true" 是登录 "false" 注册
    login_or_register: true,
  };

  changLoginOrRegister = (flag) => {
    this.setState({
      login_or_register: flag,
    });
  };

  render() {
    const { login_or_register } = this.state;
    return (
      <div className="LoginAndRegisterWrapper">
        {login_or_register ? (
          <Login changLoginOrRegister={this.changLoginOrRegister}></Login>
        ) : (
          <Register changLoginOrRegister={this.changLoginOrRegister}></Register>
        )}
        <BottomBackGround></BottomBackGround>
      </div>
    );
  }
}

export default LoginAndRegister;
